package com.sky.mapper;

import com.sky.entity.AddressBook;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AddressBookMapper {
    void insert(AddressBook addressBook);
    @Select("select * from address_book where user_id = #{userId}")
    List<AddressBook> list(long userId);
    void update(AddressBook addressBook);
    @Select("select * from address_book where id = #{id}")
    AddressBook get(long id);
    @Delete("delete from address_book where id = #{id}")
    void deleteById(long id);
    @Select("select * from address_book where is_default = 1")
    AddressBook getDefault();
    @Update("update address_book set is_default = 0 where user_id = #{userId}")
    void updateStatusByUserId(long userId);
}
